<!DOCTYPE html>
<html>

<head lang="en">
  <meta charset="UTF-8">
  <title></title>
</head>

<body>
  <script>
    //正则表达式匹配创建案例
    var a = "123";
    var pattern = /a/; 
    var pattern1 = new RegExp(a);
    console.log(pattern);
    console.log(pattern1);
  </script>
</body>

</html>